<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="../static/js/jquery-1.8.2.min.js"></script>
</head>
<body>
<div class="container">
    <div class="col-md-5"></div>
    <h2 class="col-md-7" style="color: blue">用户登录</h2>
    <form class="form-group">
        <div class="form-group col-md-4"></div>
        <div class="form-group col-md-8">
            用户名&emsp;<input type="text" name="userName" style="width: 250px">
        </div>
        <div class="form-group col-md-4"></div>
        <div class="form-group col-md-8">
            密码&emsp;&emsp;<input type="text" name="password" style="width: 250px">
        </div>
        <div class="form-group col-md-5"></div>
        <div class="form-group col-md-7"><input type="button" value="登录" id="login">&emsp;<input type="reset"></div>
    </form>
</div>
</body>
<script>
    $("#login").click(function () {
        $.post(
            "/user/login",
            $("form").serialize(),
            function (a){
                if (a>0){
                    alert("登录成功");
                    location = "/bargaining/bargainingList";
                }else {
                    alert("用户名或密码错误");
                }
            }
        )
    })
</script>
</html>
